﻿using System;
using fastCSharp;
using diantou.examDataAccess;

namespace diantou.web.enterprise
{
    /// <summary>
    /// 题目集合
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class problemList : examPermissionView<problemList>
    {
        /// <summary>
        /// 考试
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.examDataAccess.exam exam;
        /// <summary>
        /// 题目集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private examProblem[] problems;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        private bool loadView(int examId, int page, diantou.dataAccess.problem.showType showType, diantou.examDataAccess.examQuestion.sort sort, bool isAsc)
        {
            if (examId != 0)
            {
                exam = diantou.examDataAccess.clientCache.GetExam(examId, currentUser, false);
                if (exam == null) examId = 0;
            }
            examDataAccess.examProblem[] problems = clientCache.ExamProblem.Get(diantou.examDataAccess.tcpCall.examProblem.getIds(currentUser.Id, currentUser.IsChangeVisit, showType, sort, isAsc, pageInfo.Size = fastCSharp.config.pub.Default.PageSize, pageInfo.Page = page, out pageInfo.Count));
            this.problems = problems.getArray(problem => new examProblem { ExamId = examId, Problem = problem });
            return true;
        }
    }
}
